package com.itheima.api;

import java.awt.print.Printable;

public class MathTest {
    public static void main(String[] args) {


        int temp = 0;
        int count = 0;
        //1. 生成100~999之间的数
        for (int j = 100; j <= 999; j++) {
            //2.判断这个范围内的数字是不是字幂数
            int i = j;
            int tempI = i;
            double sum = 0;
            while (i != 0) {
                temp = i % 10;
                sum = sum + temp * temp * temp;
                i = i / 10;
            }
            //统计字幂数的个数
            if (tempI == sum) {
                System.out.println(tempI);
                count++;
            }
        }
        System.out.println("水仙花数的个数为" + count + "个");
    }
}
